package demo1;

import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */
public class Training {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int count = 0;
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = scanner.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < n; k++) {
                    for (int l = 0; l < m; l++) {
                        if(i==k){
                            break;
                        }
                        if(arr[i][j]==arr[k][l] && (Math.abs(i-k)==Math.abs(j-l))){
                            count++;
                        }
                    }
                }
            }
        }
        System.out.println(count);
    }

    public static void main2(String[] args) {
        long key = 101210121012l*24;
        System.out.println(key);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int sum = scanner.nextInt();
        float key = scanner.nextFloat();
        int max = Integer.MAX_VALUE;
        int maxData = Integer.MAX_VALUE;
        for (int i = 2; i <= 1000; i++) {
            int a = 1000/i;
            float b = key*i;
            float c = b*a;
            int d = a+(int)(c);
            if(maxData>d) {
                maxData = d;
                max = i;
            }
        }
        System.out.println((max==Integer.MAX_VALUE?1:max));
    }
}
